home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
misc
/
amag
/
sh9301e.lha
/
Maxon-CPP-Demo
/
AREXX
/
CmdShell.ed
next >
Wrap
Text File
|
1993-02-17
|
2KB
|
90 lines
/** $VER: CmdShell.ttx 1.0 (31.12.90)
**
** TurboText's command shell
**
** Original by David N. Junod
** Modified by Bill Hawes
** Modified by Martin Taillefer
**/
OPTIONS RESULTS
OPTIONS FAILAT 100
OPTIONS PROMPT "Cmd> "
/* Display instructions */
SAY 'Enter commands, or press CTRL-\ to exit.'
/* Get input until the user closes the Command Shell */
DO FOREVER
/* Wait until the user types a command followed by RETURN */
PARSE PULL cmdString
SELECT
WHEN (cmdString = "") | (UPPER(cmdString) = "Q") | (UPPER(cmdString) = "QUIT") THEN DO
LEAVE
END
WHEN (cmdString = "?") | (UPPER(cmdString) = "HELP") THEN DO
SAY 'Enter "HELP <command>" to obtain a command''s template.'
SAY 'Enter CTRL-\ to close this window.'
END;
OTHERWISE DO
CALL HandleCmd(cmdString)
END;
END
END
RETURN
HandleCmd: PROCEDURE
PARSE ARG cmdString
/* Execute the command */
cmdString
/* See if the command succeeded */
IF RC = 0 THEN DO
IF symbol('RESULT') == "VAR" THEN DO
SAY RESULT
END
RETURN
END
/* Wasn't an editor command, try running it as an ARexx script */
IF TurboText.LastError = 29 THEN DO
ADDRESS REXX cmdString
/* Wasn't an ARexx script, try running it as a CLI command */
IF RC > 0 THEN DO
ADDRESS COMMAND cmdString
END
END; ELSE DO
IF RC > 0 THEN DO
last = TurboText.LastError
special = TurboText.SpecialError
GetErrorInfo TurboText.LastError
IF RC = 0 THEN
msg = RESULT
ELSE DO
msg = ""
END
SAY '*** Error #'last';'msg
IF special ~= 0 THEN DO
SAY '*** Special error 'special
END
END
END
RETURN
/* end of HandleCmd() */